package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "张三";
        int age = 20;
        String gender = "男";
        String[] otherInfo = {"Java","C++","Python","长得帅","年薪12万"};
        Person person=new Person(name,age,gender,otherInfo);

        FileOutputStream fos=new FileOutputStream("person.obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);

        oos.writeObject(person);
        System.out.println("写入成功");
        oos.close();
    }
}
